package appconfig

import (
	"github.com/spf13/viper"
	"github.com/zeromicro/go-zero/core/logx"
)

type Mysql struct {
	Host     string
	Port     string
	User     string
	Password string
	Database string
}
type Redis struct {
	Host     string
	Port     string
	Password string
}
type SendSms struct {
	AccessKeyId     string
	AccessKeySecret string
}
type Appconfig struct {
	Mysql
	Redis
	SendSms
}

var AppCon Appconfig

func Init() {
	viper.SetConfigFile("appconfig/dev.yaml")
	err := viper.ReadInConfig()
	if err != nil {
		return
	}
	err = viper.Unmarshal(&AppCon)
	if err != nil {
		return
	}
	logx.Errorf("动态读取配置成功", AppCon)

}
